#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;
#include<algorithm>
#include<set>

int n;
const int N = 1e5 + 10;
long long a[N];


long long lcm(long long a, long long b, long long c = 1)
{
    while (a != b)
    {
        if (a > b)
            a = a - b;
        else
            b = b - a;
    }
    if (c != 1)
    {
        while (a != c)
        {
            if (a > c)
                a = a - c;
            else
                c = c - a;
        }
    }
    return a;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    set<int> hash;
    cin >> n;
    for (int i = 1; i <= n; i++)
        cin >> a[i];
    sort(a + 1, a + 1 + n);
    int index = 1;
    int ret = 0;
    for (int left = 1, right = 1; right <= n; right++)
    {
        hash.insert(a[right]);
        while (hash.size() >= 3)
        {
            int x1 = lcm(a[left], a[left + 1], a[left] + 2);
            int x2 = lcm(a[left], a[left + 1]);
            int x3 = lcm(a[left], a[left + 2]);
            int x4 = lcm(a[left + 1], a[left + 2]);
            int x = x1 / x2 / x3 / x4;
            if (x > ret)
            {
                ret = x;
                index = left;
            }
            hash.erase(a[left]);
            left++;
        }
    }
    cout << a[index] << " " << a[index + 1] << " " << a[index + 2] << endl;
    return 0;
}